<template>
  <div class="weChatPage">
    <div class="box">
      <div class="head">
        <img src="@/assets/image/waChatHead.png" alt="" width="650" srcset="">
        <span class="head-text">宇恒</span>
      </div>
      <div v-for="(item, index) in list" :key="index" class="body">
        <div class="time" v-if="item.time">
          <span>
            {{ item.time }}
          </span>
        </div>
        <div class="item">
          <img :src="require(`@/assets/image/${item.imgUrl}.jpg`)" style="margin-top: 5px;" alt="" srcset="" width="38" height="38">
          <div :class="{left : item.right, right : item.right}"> 
            <span v-if="item.name">{{ item.name }}</span>
            <div :class="{'text': true, 'text2': !item.name}">
              {{ item.text }}
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      list: [
        {
          imgUrl: 'ju',
          text: '传下去：我要给法王买龙虾',
          time: '昨天 18:30'
        },
        {
          imgUrl: 'longge',
          text: '6什么6什么',
          // time: '昨天 18:30'
        },
        {
          imgUrl: 'longge',
          text: '6什么6什么2222',
          right: true
          // time: '昨天 18:30'
        }
      ]
    }
  }
}
</script>

<style lang="less" scoped>
.weChatPage {
  position: relative;
  font-family:"Microsoft YaHei" !important;
  .box {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 600px;
    height: 500px;
    background: #f5f5f5;
    padding: 30px;
    transform: translate(-50%, 0);
    overflow: hidden;
    .head {
      position: absolute;
      left: -2px;
      top: 5px;
      .head-text {
        position: absolute;
        top: 15px;
        left: 24px;
        font-size: 18px;
        font-weight: 549;
        font-family: emoji;
        color: #000000;
        background: whitesmoke;
      }
    }
    .body {
      margin-top: 50px;
      .time {
        text-align: center;
        span {
          padding: 3px 4px;
          background: rgb(219, 219, 219);
          color: #FFF;
          border-radius: 3px;
        }
      }
      .item {
        display: flex;
        margin-top: 10px;
        .right {
          margin-left: 9px;
          span {
            color: #c1c1c1
          }
  
          .text {
            margin-top: 7px;
            padding: 8px;
            background: #FFF;
            position: relative;
            border-radius: 5px;
            color: #000;
            font-weight: 360;
            font-size: 14px;
            &::before {
              content: '';
              display: inline-block;
              position: absolute;
              left: -13px;
              width: 0px;
              height: 0px;
              border-width: 7px;
              border-style: dashed solid dashed dashed;
              border-color: transparent #FFF transparent transparent;
              transition: all 1s ease 0s;
              top: 12px;
            }
          }
          .text2 {
            margin-top: 4px;
            padding: 12px 8px;
          }
        }
      }
    }
  }
}
</style>